<!--- SUI模板 on 2017/3/30 -->
<script ng-init="initCss('detail-page/css/detail.css')"></script>
<div class="page">
    <header class="bar bar-nav">
        <a class="icon icon-left pull-left" href="javascript:history.go(-2);"></a>
        <h1 class="title">设备详情</h1>
        <a class="fa fa-icon fa-trash-o pull-right button-nav" href="javascript:;"
           ng-click="deleteDevice(thisDevice.deviceNo)">&nbsp;</a>
    </header>
    <div class="content" ng-init="">
        <div class="content-block">
            <p>设备编号：{{thisDevice.deviceNo}}</p>
            <p>设备名：<a href="javascript:;" ng-click="modifyDeviceName();">{{thisDevice.deviceName}}</a></p>
            <p>设备简介/描述：<a href="javascript:;" ng-click="modifyDeviceDiscription()">{{thisDevice.deviceDiscription}}</a>
            </p>
            <p>
            <div class="item-content">
                <div class="item-inner">
                    <div class="item-title label clearfix">
                        备忘录开关：
                        <label class="label-switch">
                            <input type="checkbox" ng-model="thisDevice.memorandum.exist" ng-change="saveEdit()">
                            <div class="checkbox"></div>
                        </label>
                    </div>
                </div>
            </div>
            </p>
            <p ng-if="thisDevice.memorandum&&thisDevice.memorandum.exist">备忘录内容：
                <a href="javascript:;" ng-click="modifyDeviceMemorandum()">{{thisDevice.memorandum.content?thisDevice.memorandum.content:'暂无备忘录'}}</a>
            </p>
            <p>设备总运行时间：{{thisDevice.runningDuration}}h&nbsp;
                <a class="record" href="#running-record?deviceIndex={{deviceIndex}}">查看记录</a>
            </p>
            <p><a href="#device-repair?deviceNo={{thisDevice.deviceNo|escape}}" class="button">设备维修</a></p>
            <p><a href="javascript:;" ng-click="runDevice()" class="button">添加日常运行时间</a></p>
        </div>
        <div ng-repeat="maintain in thisDevice.maintainPlans"
             ng-class="{true:'maintain-block single-maintain',false:'maintain-block double-maintain'}[$index%2==0]">
            <p>
                {{maintain.maintainName}}（<span
                    style="color: {{maintain.currentMaxPercentage|invokeObjectMethod:'gradientColorsPercentage':[colorSetting]}}">{{maintain.currentMaxPercentage|percentage}}</span>）
                <a class="fa fa-icon fa-trash-o red" href="javascript:;" ng-if="$index>2"
                   ng-click="removeSpecialMaintain($index)">&nbsp;</a>：{{maintain.currentRunningDuration}}/<a
                    href="javascript:;" ng-click="modifyPlansDuration($index)">{{maintain.limitingConditionFromRunningDuration}}h</a>
                （或{{maintain.currentDaysConsumedNumber}}/<a
                    href="javascript:;" ng-click="modifyPlansDaysNumber($index)">{{maintain.limitingConditionFromDaysNumber}}天</a>）
                <a class="record"
                   href="#maintain-record?deviceIndex={{deviceIndex}}&maintainPlanIndex={{$index}}">查看记录</a>
            </p>
            <p>保养内容：<a href="javascript:;" ng-click="modifyPlansContent($index)">{{maintain.maintainContent}}</a>
            </p>
            <p><a href="javascript:;" ng-click="doMaintain($index)" class="button">执行{{maintain.maintainName}}</a>
            </p>
        </div>
        <div class="content-block">
            <p><a href="javascript:;" ng-click="addSpecialMaintain()">额外添加保养计划</a></p>
        </div>
    </div>
</div>
<div ng-init="suiMobileInit()"></div>